// JavaScript Document
//Order
function changelist(v) {
	$.getJSON("/index.php?action=get_topic&v="+v , function(result) {
		$("#topic").empty();
		if (result == null) {
			$("#topic").append("<option value=''>暂无数据</option>");
		} else {
			$("#topic").append("<option value=''>请选择主题分类</option>");
			$.each(result, function(k, v) {
				$("#topic").append("<option value='" + k+  "'>" + v + "</option>");
			});
		}
	 });
}

function create_qa() {

    var type = $('input[name="type"]:checked').val();
	var topic = $('#topic').val();
	var title = $('#title').val();
	var content = $('#content').val();
	var complaint_fstime = $('#complaint_fstime').val();
  
        if(topic == ''){
		alert('请选择主题分类');
		return false;
		}else if(title == ''){
		alert('请输入标题');
		return false;
		}else if(content == ''){
		alert('请输入内容');
		return false;
		}
		var S = {};
		S.data = {
			type : type,
			topic : topic,
			title : title,
			content : content,
			complaint_fstime : complaint_fstime
			
		};
      /*if( confirm('确定发布么?') == false){
        return false;
        }*/
   
		$.ajax( {
			url : "/index.php?action=create_complaint",
			type : "POST",
			data : S.data,
			cache : false,
			dataType : "json",
			success : function(json) {
				// alert(json.m);
				if (json.c == 'error') {
					alert(json.info);
					return false;
				} else if (json.c == 'success') {
					success();
				}
			},
			error : function() {
				return false;
			}
		});
	
}

